<h1><a href="<?php echo $this->url(array("controller" => "attributes", "action" => "list-sets"), "admin", true); ?>"><?php echo $this->translate->_("Attributes"); ?></a> &raquo; <?php echo sprintf($this->translate->_("List Attributes for %s"), $this->set); ?></h1>
<div class="rbcontent" id="search_fields">
	<form name="search" action="<?php echo $this->url; ?>" method="get">
	<input type="hidden" name="order" id="order" value="<?php echo $this->order; ?>" />
	<input type="hidden" name="dir" id="dir" value="<?php echo $this->dir; ?>" />
	<table>
	<col width="430" />
		<tr>
			<td>
				<div class="filter_item">
					<label><?php echo $this->translate->_("Label"); ?>:</label>
					<input type="text" name="label" value="<?php echo $this->label; ?>" />
				</div>
			</td>
			<td>
				<div class="filter_item">
					<label><?php echo $this->translate->_("Unique"); ?>:</label>
					<select name="unique">
						<option></option>
						<option value="1" <?php echo $this->unique == '1' ? 'selected="selected"' : ''; ?>><?php echo $this->translate->_("Yes"); ?></option>
						<option value="0" <?php echo $this->unique == '0' ? 'selected="selected"' : ''; ?>><?php echo $this->translate->_("No"); ?></option>
					</select>
				</div>
			</td>
		</tr>
		<tr>
			<td>
				<div class="filter_item">
					<label><?php echo $this->translate->_("Code"); ?>:</label>
					<input type="text" name="code" value="<?php echo $this->code; ?>" />
				</div>
			</td>
			<td>
				<div class="filter_item">
					<label><?php echo $this->translate->_("Required"); ?>:</label>
					<select name="required">
						<option></option>
						<option value="1" <?php echo $this->required == '1' ? 'selected="selected"' : ''; ?>><?php echo $this->translate->_("Yes"); ?></option>
						<option value="0" <?php echo $this->required == '0' ? 'selected="selected"' : ''; ?>><?php echo $this->translate->_("No"); ?></option>
					</select>
				</div>
			</td>
		</tr>
		<tr>
			<td>
				<div class="filter_item">
					<label><?php echo $this->translate->_("Type"); ?>:</label>
					<select name="type">
						<option></option>
						<?php foreach($this->types as $idx => $type): ?>
							<option value="<?php echo $idx; ?>" <?php echo $this->type == $idx ? 'selected="selected"' : ''; ?>><?php echo $type; ?></option>
						<?php endforeach; ?>
					</select>
				</div>
			</td>
			<td></td>
		</tr>
		<tr>
			<td>
				<div class="filter_item">
					<label><?php echo $this->translate->_("Active"); ?>:</label>
					<select name="active">
						<option></option>
						<option value="1" <?php echo $this->active == '1' ? 'selected="selected"' : ''; ?>><?php echo $this->translate->_("Yes"); ?></option>
						<option value="0" <?php echo $this->active == '0' ? 'selected="selected"' : ''; ?>><?php echo $this->translate->_("No"); ?></option>
					</select>
				</div>
			</td>
			<td>
				<div class="filter_item">
					<label></label>
					<input type="button" value="<?php echo $this->translate->_("Search"); ?>" data-type="submit" />
					<input type="button" value="<?php echo $this->translate->_("Reset"); ?>" data-type="reset" />
				</div>
			</td>
		</tr>
	</table>
	</form>
</div>
<?php if(count($this->attrs) > 0): ?>
	<?php echo $this->paginationControl($this->attrs, 'Elastic', 'controls.phtml', array('translate' => $this->translate)); ?>
	<table class="main">
		<thead>
			<tr>
				<th class="<?php $col = "a.label"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("Label"); ?></th>
				<th class="<?php $col = "a.code"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("Code"); ?></th>
				<th class="<?php $col = "a.type"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("Type"); ?></th>
				<th class="<?php $col = "a.active"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("Active"); ?></th>
				<th class="<?php $col = "a.is_unique"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("Unique"); ?></th>
				<th class="<?php $col = "a.is_required"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("Required"); ?></th>
				<th class="<?php $col = "a.print_order"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("Order"); ?></th>
				<th width="1%"></th>
				<th width="1%"></th>
				<th width="1%"></th>
			</tr>
		</thead>
		<tbody>
			<?php foreach($this->attrs as $attr): ?>
				<tr>
					<td><a href="<?php echo $this->url(array('controller'=>'attributes', 'action'=>'edit-attribute', 'id'=> $attr["id"]), 'admin', true); ?>"><?php echo Petolio_Service_Util::Tr($attr['label']); ?></a></td>
					<td><?php echo $attr['code']; ?></td>
					<td><?php echo $this->types[$attr['attribute_input_type_id']]; ?></td>
					<td><?php echo $attr['active'] == 1 ? $this->translate->_("Yes") : $this->translate->_("No"); ?></td>
					<td><?php echo $attr['is_unique'] == 1 ? $this->translate->_("Yes") : $this->translate->_("No"); ?></td>
					<td><?php echo $attr['is_required'] == 1 ? $this->translate->_("Yes") : $this->translate->_("No"); ?></td>
					<td><?php echo $attr['print_order']; ?></td>
					<td nowrap="nowrap" style="text-align: center;"><?php if($attr['attr_type'] == 'select'): ?><a href="<?php echo $this->url(array('controller'=>'attributes', 'action'=>'list-options', 'id'=> $attr["id"]), 'admin', true); ?>"><?php echo $this->translate->_("Options") ?></a><?php endif; ?></td>
					<td nowrap="nowrap" style="text-align: center;"><a href="<?php echo $this->url(array('controller'=>'attributes', 'action'=>'edit-attribute', 'id'=> $attr["id"]), 'admin', true); ?>"><?php echo $this->translate->_("Edit") ?></a></td>
					<td nowrap="nowrap" style="text-align: center;"><a href="<?php echo $this->url(array('controller'=>'attributes', 'action'=>'delete-attribute', 'id'=> $attr["id"]), 'admin', true); ?>" class="reqconf" title="<?php echo $this->translate->_("Are you sure you want to delete this attribute?"); ?>"><?php echo $this->translate->_("Delete"); ?></a></td>
				</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
	<?php echo $this->paginationControl($this->attrs, 'Elastic', 'controls.phtml', array('translate' => $this->translate)); ?>
<?php else: ?>
	<div class="error"><?php echo $this->translate->_("No records found."); ?></div>
<?php endif; ?>
<form style="background: #fff;">
	<input type="button" onclick="document.location='<?php echo $this->url(array('action' => 'add-attribute')); ?>';" class="submit" value="<?php echo $this->translate->_("Add Attribute"); ?>" />
	<div class="clear"></div>
</form>
<script type="text/javascript">
	READY(function() {
		Admin.loadJs('filters/base.js');
		Filters.load('/attributes/list-attributes/id/<?php echo $this->id; ?>');
	});
</script>